import * as req from '@/request';

export async function list(
  params?: { [key: string]: any },
  sorter?: { [key: string]: any },
  filter?: { [key: string]: any },
) {
  return req.postForm<API.AdminList>('/admin/list', params, sorter, filter);
}

export async function get(id: number) {
  return req.get<API.AdminForm>(`/admin/get/${id}`);
}

export async function add(data: { [key: string]: any }) {
  return req.postForm<API.Result>('/admin/create', data);
}

export async function update(data: { [key: string]: any }) {
  return req.postForm<API.Result>('/admin/update', data);
}

export async function remove(data: { key: number }) {
  return req.postForm<API.Result>('/admin/delete', data);
}

export async function funRightTree() {
  //await utils.waitTime(3000);
  return req.get<API.FuncRightTree>('/admin/funcRightTree');
}
